﻿Imports DevExpress.XtraEditors.Drawing
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraEditors.Registrator
Imports DevExpress.XtraEditors.ViewInfo
Imports DevExpress.XtraEditors
Imports IControl

Namespace IControls
    <UserRepositoryItem("RegisterRepositoryItemIMeMoEdit")> _
    Public Class RepositoryItemIMeMoEdit
        Inherits RepositoryItemMemoEdit
        Shared Sub New()
            RegisterIMeMoEdit()
        End Sub

        Public Const PartialIMeMoEdit As String = "IMeMoEdit"

        Public Overrides ReadOnly Property EditorTypeName() As String
            Get
                Return PartialIMeMoEdit
            End Get
        End Property

        Public Shared Sub RegisterIMeMoEdit()

            EditorRegistrationInfo.Default.Editors.Add(New EditorClassInfo(PartialIMeMoEdit, GetType(IMeMoEdit), GetType(RepositoryItemIMeMoEdit), GetType(MemoEditViewInfo), New MemoEditPainter(), True, EditImageIndexes.MemoEdit))
        End Sub

        Protected startpositon As Integer

        Public Property Startposition() As Integer
            Get
                Return startpositon
            End Get
            Set(value As Integer)
                If startpositon <> value Then
                    startpositon = value
                    OnPropertiesChanged()
                End If
            End Set
        End Property

        Public Overrides Sub Assign(item As RepositoryItem)
            BeginUpdate()
            Try
                MyBase.Assign(item)
                Dim source As RepositoryItemIMeMoEdit = DirectCast(item, RepositoryItemIMeMoEdit)
                If source Is Nothing Then
                    Return
                End If
                startpositon = source.Startposition
            Finally
                EndUpdate()
            End Try

        End Sub
    End Class
End Namespace
